package com.cobo.fitness.web.fitness.trans;

import com.cobo.fitness.web.fitness.vo.DictVo;
import com.cobo.fitness.web.post.entity.Post;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

import java.util.List;

//@Mapper(componentModel  = "spring")
@Mapper
public interface PostMapper {

    PostMapper INSTANCE = Mappers.getMapper( PostMapper.class );
//    @Mapping(target = "createTime", source = "createTimeStr", dateFormat = "yyyy-MM-dd~hh:mm:ss")
    @Mappings({
            @Mapping(target = "label", source = "id")
            ,@Mapping(target = "value", source = "content")
    })
    DictVo postToDict(Post post);

    List<DictVo> postsToDicts(List<Post> posts);
}
